import $api from '.';

interface coupon {
  name: string;
  number: number | string;
  [key: string]: any;
}

// 添加
export const addCoupon = function (data: coupon) {
  return $api.post('/coupon', data);
};

// 获取列表
export const getCouponList = function (data: { $limit: any; $skip: number}) {
  console.log('data', data);
  data.$limit = data.$limit || 20;
  data.$skip = data.$skip || 0;
  return $api.get('/coupon', {
    params: data,
  });
};
// 删除
export const delCoupon = function (id: number) {
  return $api.delete(`/coupon/${id}`);
};

// 修改
export const updateCoupon = function (id: number, data: any) {
  return $api.patch(`/coupon/${id}`, data);
};

export default {};
